<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>国象选品后台</title>
<link rel="stylesheet" href="../../layui/css/layui.css" />
<link rel="stylesheet" href="css/admin.css" />
<script src="../../statics/js/jquery-1.12.4.js"></script>
</head>
<body>
	<form class="layui-form" action="">
		<table class="layui-table layui-table-add" lay-skin="nob">
			<tbody>
				<tr>
					<th width="100"><span class="red">*</span>拒绝理由</th>
					<td><select id="rejectSelect" lay-filter="rejectSelect"
						aria-invalid="false">
							<option lay-value="-1">请选择拒绝理由</option>
							<option lay-value="0">尊敬的客户，经核实，您提供的项目信息不存在；</option>
							<option lay-value="1">尊敬的客户，经核实，您提供的项目信息已存在；</option>
							<option lay-value="2">尊敬的客户，经核实，您提供的项目信息有误；</option>
					</select></td>
				<tr>
					<td><input type="hidden" id="id" name="id" />
					</td>
					<td><textarea id="reject_reason" name="reject_reason" required
							lay-verify="required" placeholder="请输入拒绝理由,提交后会微信推送服务消息给用户。"
							class="layui-textarea"></textarea></td>
				</tr>
			</tbody>
		</table>
		<div style="margin-left: 145px; margin-bottom: 15px;">
			<div lay-filter="submit_reject_reason" lay-submit=""
				class="layui-btn" style=" min-width: 150px;">确 定</div>
		</div>
	</form>


	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script>
	    /**解析地址ID  参数值****/
		function getUrlParam(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
			var r = window.location.search.substr(1).match(reg);
			if (r != null) return unescape(r[2]);
			return null;
		}
		/***layUI  初始模块加载***/
		layui.use(['jquery','form'], function(){
			var $ = layui.jquery,form = layui.form,layer = layui.layer;
			
			layer.msg("当前项目ID="+getUrlParam("id"), {icon: 1,time:3000});
			//return ;
			$("#id").val(getUrlParam("id"));
			//监听下拉框数据变化
			form.on('select(rejectSelect)',function(data){
			//	reject_reason1=data.value;
				reject_reason=data.elem[data.elem.selectedIndex].text;
				console.info("reject_reason"+reject_reason);
				$("#reject_reason").val(reject_reason);
				form.render('select');
				
			})
		    //监听提交
		   var lock = false;
		   form.on('submit(submit_reject_reason)', function(data){
		   
		   		if (!lock) {
		   		        lock=true;
				        $.ajax({
	                    type : "POST",
	                    url : '../../web/reject_pass',
	                    //async:false,
	                    data : {
	                        s_form_data : JSON.stringify(data.field)
	                    },
	                    dataType : "json",
	                   
	                    success : function(data) {
	                        if(data.status==false){
								//lock = false;  
	                            layer.msg(data.msg, {icon: 5,time:1000});
							}else{
								//lock = false;  
							    layer.msg(data.msg, {icon: 1});
							    setTimeout("wait_exe()",1000) ;
							    }
	                    }
	             });
				}else{
					alert("正在处理！");
				}
			    
			     return false;
		     });
		    
		    
		});
		
		function wait_exe (){
		   window.parent.location.reload();
		   var index = parent.layer.getFrameIndex(window.name);
	       parent.layer.close(index);
	    }
	</script>

</body>
</html>